import React, { Component } from 'react'

export class Alter extends Component {
    constructor(props){
        super(props)
        this.state={
            flag:false,
        }
    }
  render() {
      const {flag}=this.state
    return (
        <div>
           <div className='footer'>
          <button onClick={()=>{
               this.setState({
                  flag:true
              })
          }
             
          }>购物车</button> 
          </div>
          {
              flag ? <div className='mask'>
                  <div className='cont'>
                      <span onClick={()=>{
                           this.setState({
                              flag:false
                          })
                      }
                         
                      }>x</span>
                      这里是内容区
                  </div>
              </div> : null
          }
          </div>
     
    )
  }
}

export default Alter